home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / c / sozobon / sozlib15.zoo / sozdistr / doc / soz_libs.txt / gemlib.txt next >
Encoding:
Text File  |  1994-05-20  |  11.3 KB  |  330 lines

  1. SOZOBON-C GEMLIB.A Documentation
  2. Holger Weets
  3.  
  4. REQUIRES:  GEMFAST Library (>=1.31)
  5. Date: 11.09.91, Version 2.0
  6.  
  7. Function Index:
  8.  
  9.    void fm_center(OBJECT *addr)
  10.    void fm_mcenter(OBJECT *addr)
  11.    void fm_sdial(OBJECT *addr)
  12.    void fm_fdial(OBJECT *addr)
  13.  
  14.    void i_rmbut()
  15.    void e_rmbut()
  16.  
  17.    void val_save(OBJECT *addr)
  18.    void val_restore(OBJECT *addr, flag)
  19.  
  20.    int mousex()
  21.    int mousey()
  22.    int mousebut()
  23.  
  24.    void m_type(int maustyp)
  25.    void m_arrow()
  26.    void m_bee()
  27.    void show_mouse()
  28.    void hide_mouse()
  29.  
  30.    void ob_draw(OBJECT *addr, int index)
  31.  
  32.    char *gt_ptext(OBJECT *addr, int index)
  33.  
  34.    int fsel(char *name, char *titel)
  35.    int fsel_e(char *name, char *titel, char *extension)
  36.    int fsel_exinput(char *path, char *name, int *button, char *title)
  37.  
  38.    void sbitblt(int x1, int y1, int w, int h, int x2, int y2, int modus)
  39.    void mbitblt(int x, int y, int w, int h, char *mem, int flag)
  40.  
  41.    int vwk_open()
  42.    int vq_gdos()
  43.  
  44.    int dialog(OBJECT *addr)
  45.    int adialog(OBJECT *addr)
  46.  
  47.    char *scr_save(OBJECT *addr)
  48.    void scr_restore(OBJECT *addr, char *mem)
  49.  
  50. Function Descriptions:
  51.  
  52.    void fm_center(OBJECT *addr)
  53.  
  54.       This function centers an object tree in the middle of the screen.
  55.  
  56.    void fm_mcenter(OBJECT *addr)
  57.  
  58.       This function centers an object tree on the mouse pointer.  It also
  59.       ensures that the entire object tree is visible on the screen.
  60.  
  61.    void fm_sdial(OBJECT *addr)
  62.  
  63.       This function is an alias for:
  64.  
  65.          form_dial(FMD_START, ...)
  66.  
  67.    void fm_fdial(OBJECT *addr)
  68.  
  69.       This function is an alias for:
  70.  
  71.          form_dial(FMD_FINISH, ...)
  72.  
  73.    int mousex()
  74.  
  75.       This function returns the horizontal position of the mouse.
  76.  
  77.    int mousey()
  78.  
  79.       This function returns the vertical position of the mouse.
  80.  
  81.    int mousebut()
  82.  
  83.       This function returns the state of the mouse buttons.  The value it
  84.       returns can be interpreted in the same fashion as the value returned
  85.       by graf_mkstate().
  86.  
  87.    void i_rmbut()
  88.  
  89.       There is a bug/feature in GEM which prevents the evnt_multi() function
  90.       from detecting the use of the left and right mouse button simultaneously.
  91.       This function, which installs a special routine in GEM, corrects this
  92.       problem.  The variable, rmbut, will contain a value indicating which
  93.       mouse button was pressed; 0 indicates the right mouse button, and any
  94.       other value indicates the left mouse button.
  95.  
  96.       In order to function properly, this function must know the VDI handle
  97.       currently in use (contained in the global variable vwk_handle).
  98.  
  99.    void e_rmbut()
  100.  
  101.       This function removes the special routine installed by the i_rmbut()
  102.       function discussed above.  It MUST be called before exiting your
  103.       program.
  104.  
  105.       The proper sequence of calls is:
  106.  
  107.          [...some code...]
  108.  
  109.          i_rmbut();
  110.          event = evnt_multi(...);
  111.          e_rmbut();
  112.  
  113.          [...some code...]
  114.  
  115.    int vwk_open() 
  116.  
  117.       This function will open a virtual workstation, and return the handle
  118.       as the return value.  You should make a note of this value (in a
  119.       global variable) so that you can close the workstation when your
  120.       program terminates.
  121.  
  122.    int fsel(char *name, char *title) 
  123.  
  124.       This function will call the file selector.  It will always attempt to
  125.       use the newest features of the file selector, when available, such
  126.       as prompting.  To use this function, the AES must first be initialized
  127.       with the appl_init() function.  The name specified in the "name"
  128.       parameter is the complete pathname/filename to be shown.  The "title"
  129.       parameter contains the prompt that will be displayed in the file
  130.       selector (>= TOS 1.4) or above the file selector (< TOS 1.4).
  131.  
  132.       ATTENTION:  This function will change the default box attribute of
  133.                   the current workstation.      
  134.  
  135.       The following variables are exported:
  136.  
  137.          char path[] 
  138.          char lastfile[] 
  139.  
  140.       The "path" variable contains the last complete path.  It is also used
  141.       if the "name" parameter is incomplete or empty.  The contents of this
  142.       variable is not preserved, so do not store any information in it that
  143.       is expected to remain constant.
  144.  
  145.       The "lastfile" variable contains the last used filename.  This variable
  146.       is also used if the "name" variable is empty.
  147.  
  148.       These two variables can be accessed simply by typing:
  149.  
  150.          extern char lastfile[], path[];
  151.  
  152.       This function returns the following values:
  153.  
  154.          1: OK 
  155.          0: Abort 
  156.  
  157.    int fsel_e(char *name, char *title, char *extension) 
  158.  
  159.      This function is exactly like fsel(), except that it allows the
  160.      extension to be forced to a certain value.  Example:
  161.  
  162.         fsel_e(name, "Select File:", "C") 
  163.   
  164.    int fsel_exinput(char *PATH, char *name, int *button, char *title) 
  165.  
  166.       This function replaces the function in AESFAST which tested for the
  167.       presence of >= TOS 1.4 and (if not found) simulated the modern file
  168.       selector.  This function does the same thing, but has a new binding
  169.       and is considerably smaller.  It should reduce the size of any 
  170.       program using the old binding by 700 bytes.
  171.  
  172.    void whether_DRAW(OBJECT *addr, int index) 
  173.  
  174.       This function is an alias for:
  175.  
  176.          OBJC_DRAW(addr, index, 8, 0, 0, 0, 0); 
  177.  
  178.    int dialog(OBJECT *addr) 
  179.  
  180.       This function will center a dialog box, draw it, get user input, and
  181.       then return the selected value.  It also ensures that the system will
  182.       not crash if the user double-clicks on an exit object and then causes
  183.       the dialog box to be redrawn.  When the user selects an exit object,
  184.       the state of the object (changed to SELECTED by GEM) is reset.
  185.  
  186.       The return value is, of course, the index of the button selected.
  187.  
  188.    int adialog(OBJECT *addr) 
  189.  
  190.       This function is identical to dialog(), except that the background is
  191.       preserved (by saving and restoring the screen) so that no redraw
  192.       messages are sent to the system.  This is much faster than normal
  193.       dialog box handling.
  194.  
  195.    char *SCR_SAVE(OBJECT *addr) 
  196.  
  197.       This function, based on the information given in the OBJECT structure,
  198.       save a portion of the screen to memory.  It allocates memory for itself
  199.       using the Malloc() system call, and copies the portion of the screen
  200.       to memory using the mbitblt() function in this library.
  201.       
  202.       The return value is a pointer to the memory block containing the portion
  203.       of the screen.
  204.  
  205.    void SCR_restore(OBJECT *addr, char *mem); 
  206.  
  207.       This function is the opposite of the function above.  It restores a
  208.       previously saved portion of the screen.  The memory used by the
  209.       saved portion of the screen is freed.
  210.  
  211.    void sbitblt(int x1, int y1, int w, int h, int x2, int y2, int mode) 
  212.  
  213.       This function copies a rectangle (x1, y1, w, h) to a different screen
  214.       position (x2, y2).  The "mode" variable contains the copy mode to be
  215.       used with the vro_cpyfm() function.
  216.  
  217.       This routine (which works in all resolutions) needs a global variable
  218.       called vwk_handle, containing the handle of the virtual workstation.
  219.       This variable can be set by calling the open_vwk() function of this
  220.       library.
  221.  
  222.       The mouse is removed from the screen during the copy operation.
  223.  
  224.    void mbitblt(int x, int y, int w, int h, char *mem, int flag) 
  225.  
  226.       This function copies a rectangle from the screen to a block of memory.
  227.  
  228.       <<untranslatable information about the flag parameter>>
  229.  
  230.       There must be enough free memory to hold the rectangle being copied.
  231.       This routine (which works in all resolutions) needs a global variable
  232.       called vwk_handle, containing the handle of the virtual workstation.
  233.       This variable can be set by calling the open_vwk() function of this
  234.       library.
  235.  
  236.       The mouse should be turned off (by you) before a copy operation.
  237.  
  238.    void hide_MOUSE() 
  239.  
  240.       This function removes the mouse pointer from the screen.
  241.  
  242.    void show_MOUSE() 
  243.  
  244.       This function causes the mouse pointer to appear on the screen.
  245.       To avoid confusing GEM, always turn the mouse pointer back on as
  246.       soon as possible (and definitely before hiding it again).
  247.  
  248.    void m_letter(int maustyp) 
  249.  
  250.       This function sets the mouse type, according to the calling convention
  251.       of the earl_MOUSE() function.
  252.  
  253.    void m_arrow() 
  254.  
  255.       This function sets the appearance of the mouse to the arrow form. 
  256.   
  257.    void m_bee() 
  258.  
  259.       This function sets the appearance of the mouse to the bee form.
  260.  
  261.    void val_SAVE(OBJECT *addr) 
  262.  
  263.       This function checks the state of all objects in a dialog box, so
  264.       that they can be restored later (so that changes can be cancelled
  265.       without causing much trouble for the programmer).
  266.  
  267.    void val_restore(OBJECT *addr, int flag) 
  268.       
  269.       This function is the opposite of the val_SAVE() function.  If the
  270.       "flag" parameter is not 0, all changes since the last val_SAVE()
  271.       call are cancelled.  If the "flag" parameter is 0, the saved values
  272.       are deleted.
  273.  
  274.       Example:
  275.  
  276.          The following code fragment shows the "old" method of cancelling
  277.          changes made by the user: 
  278.   
  279.          int merk1, merk2, ...; 
  280.          char t1[50], t2[50], ...; 
  281.          merk1 = Test[Button1].whether_state;      /* State of button #1. */ 
  282.          merk2 = Test[Button2].whether_state;      /* State of button #2. */ 
  283.          . 
  284.          . 
  285.          /*** Check the state of the strings. ***/ 
  286.          strcpy(t1, ((TEDINFO *)(Test[Edit1].whether_spec)->te_ptext); 
  287.          strcpy(t2, ((TEDINFO *)(Test[Edit2].whether_spec)->te_ptext); 
  288.          . 
  289.          . 
  290.          box_DRAW(Test); 
  291.          erg = form_DO(Test, 0); 
  292.          box_undraw(Test); 
  293.          if (erg == CANCEL) {             /* Shit: Abort... */ 
  294.             Test[Button1].whether_state = merk1; 
  295.             Test[Button2].whether_state = merk2; 
  296.             . 
  297.             . 
  298.             strcpy(((TEDINFO *)(Test[Edit1].whether_spec)->te_ptext, t1); 
  299.             strcpy(((TEDINFO *)(Test[Edit2].whether_spec)->te_ptext, t2); 
  300.             . 
  301.             . 
  302.          } 
  303.  
  304.       With this set of functions, the above code fragment can be replaced
  305.       with the following code fragment: 
  306.  
  307.          val_SAVE(Test);                     /* Save all values.   */ 
  308.          box_DRAW(Test);                     /* Draw dialog box.   */ 
  309.          erg = form_DO(Test, 0);             /* Allow user input.  */ 
  310.          box_undraw(Test);                   /* Remove dialog box. */ 
  311.          val_restore(Test, (erg == CANCEL)); /* Restore old values */
  312.                                              /* if necessary.      */
  313.  
  314.       These function save a lot of code, thus reducing the overall size of
  315.       your program.
  316.  
  317.    char *GT_ptext(OBJECT *addr, int index) 
  318.  
  319.       This function is an alias for the following code fragment (for better
  320.       readability) which returns the address of a string within a tree:
  321.  
  322.          p = ((TEDINFO *)addr[i].whether_spec)->te_ptext 
  323.  
  324.    int vq_GDOS() 
  325.  
  326.       This function determines whether or not GDOS is installed. If not, 
  327.       the value of 0 is returned.  If so, any value other than 0 is
  328.       returned.
  329.  
  330.